/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.bean;

import org.ipti.br.tag.bo.HumanBO;
import org.ipti.br.tag.entity.Actor;
import org.ipti.br.tag.entity.Human;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
 *
 * @author israel
 */
@Named
@SessionScoped
public class SessionBean extends AppBaseBean implements Serializable{

    @Inject
    private HumanBO humanBO;
    private Actor loggedActor;

    public SessionBean() {
    }

    public Human findHuman(Long humanID) {
        return humanBO.find(humanID);
    }
    
    public void logout() {
        loggedActor = null;
        resetSession();
        redirect("/login/login.xhtml");
    }
    
    public boolean isLogged() {
        return (loggedActor != null);
    }

    public Actor getLoggedActor() {
        return loggedActor;
    }

    public void setLoggedActor(Actor loggedActor) {
        this.loggedActor = loggedActor;
    }
}
